<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    const promise = new Promise((resolve, reject) => {
        resolve('成功')
    })

    const result = promise.then(
        function (value) {
            console.log('成功', value);
            // return { name: 'zs' }
            // throw new Error('失败')
            // return new Promise((resolve, reject) => {
            //     resolve('成功1')
            // })
            return Promise.reject('失败1')
        },
        function (reason) {
            console.log('失败', reason);
        }
    )
    // then方法返回一个Promise对象
    // Promise对象的状态和结果由传入then的回调函数的执行结果决定
    console.log('then的返回值：', result);


    // Promise的链式调用：then方法返回的Promise对象，可以继续调用then方法
</script>

</html>